perf(update): flush buffered in-place overwrites per storage page (C6, Fase B) - #379
Merged
Merged
Conversation
…, Fase B) The UPDATE commit path buffered one record per row (B7) and FlushBuffered- Overwrites wrote each with two pwrites (length prefix + payload). ~10K-row UPDATEs were therefore dominated by per-row write syscalls (~88K ops/s on the fair-PK fixed-width table, ~2,75x behind SQLite). The flush now reads the current on-disk content of each touched storage page once, patches the row payloads into the copy, and writes the page once. Payloads that cross a page boundary take the direct per-record path first so later page reads already include them; length prefixes are unchanged (same-length overwrites are the only in-place case). Runs under appendLock at commit; rollback semantics unchanged (buffers still dropped on rollback). Fair-PK harness (--pk, same machine as master, 2 runs each): fixed-width UPDATE ~88K -> ~153-164K ops/s (+75-85%; gap vs SQLite ~1,7x) legacy UPDATE ~53-56K -> ~64-70K ops/s (+20-25%) DELETE within noise. Regression: AscendingUpdateBatch_BatchedPageFlush_AppliesEveryRow_AcrossReopen (2000-row UPDATE batch = one commit with 2000 buffered overwrites; point reads + reopen verify the page read-modify-write flush). Full suite 1765 tests, 0 failed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Samenvatting
Buffered in-place UPDATE-overwrites worden per storage-page geflusht (C6, eerste concrete Fase-B-mijlpaal).
De UPDATE-commit deed per rij 2 pwrites (lengte-prefix + payload): bij ~10K-rij UPDATEs domineerden de per-rij write-syscalls (~88K ops/s op de fair-PK fixed-width tabel, ~2,75x achter SQLite). Nu:
FlushBufferedOverwritesleest de on-disk content van elke geraakte storage-page één keer, patcht de rij-payloads in de kopie en schrijft elke page één keer.appendLockbij commit; rollback-semantiek ongewijzigd.Metingen (fair-PK
--pk, zelfde machine als master, 2 runs elk)UPDATE-gap vs SQLite op fixed-width: ~2,75x → ~1,7x.
Validatie
AscendingUpdateBatch_BatchedPageFlush_AppliesEveryRow_AcrossReopen: 2000-row UPDATE-batch (één commit, 2000 buffered overwrites → per-page RMW-flush), point reads + reopen.